Skip to content

[Console] Preserve spaces in URL query strings#270881

Merged
kapral18 merged 1 commit into
elastic:mainfrom
kapral18:console-url-query-space-escaping-227733
May 26, 2026
Merged

[Console] Preserve spaces in URL query strings#270881
kapral18 merged 1 commit into
elastic:mainfrom
kapral18:console-url-query-space-escaping-227733

Conversation

@kapral18
Copy link
Copy Markdown
Contributor

@kapral18 kapral18 commented May 23, 2026

Closes #227733

Summary

  • Preserves unquoted spaces in Console URL query values instead of treating them as request-line trailing text.
  • Keeps inline // and # comment stripping for request URLs.
  • Adds focused edge-case coverage for the helper and the full parseLine request-line path.

Root Cause

  • removeTrailingWhitespaces stopped at the first unquoted space, so GET myindex/_search?q=type:organisation AND elastic was truncated before AND elastic.

Fix

  • Use the first ? outside quotes as the query-string boundary.
  • Preserve spaces inside query values unless the space starts a trailing inline // or # comment.
  • Preserve the existing leading-space behavior and ignore comment markers inside quoted query values.

Before

image

After

image

Test Plan

  • node scripts/jest src/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.test.ts
  • node scripts/eslint src/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.ts src/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.test.ts
  • node scripts/type_check --project src/platform/plugins/shared/console/tsconfig.json
  • node scripts/check_changes.ts
  • Manually verified in Console that unquoted query spaces are preserved, trailing // and # comments are stripped, comment markers inside quoted query values are preserved, quoted ? path text is not treated as the query delimiter, and trailing non-query text is trimmed before sending the request.

Assisted with Cursor using GPT-5.5

@kapral18 kapral18 added Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more t// Feature:Console Dev Tools Console Feature release_note:skip Skip the PR/issue when compiling release notes backport:all-open Backport to all branches that could still receive a release labels May 23, 2026
@kapral18 kapral18 requested a review from Copilot May 23, 2026 22:19
@kapral18 kapral18 added reviewer:claude PR review and comments with Claude reviewer:codex PR review and comments with Codex labels May 23, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Preserves unquoted spaces inside Console request URL query values so request-lines like ...q=foo AND bar aren’t truncated, while still stripping trailing inline // and # comments.

Changes:

  • Updates removeTrailingWhitespaces to treat spaces differently once the URL has entered the query string.
  • Keeps inline-comment stripping behavior (// and #) when whitespace begins an inline comment.
  • Adds Jest coverage for the reported bug case and the parseLine request-line path.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.ts Adjusts URL whitespace stripping to preserve query-value spaces while still recognizing inline comments.
src/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.test.ts Adds tests covering unquoted query spaces and the request-line parsing path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kapral18 kapral18 force-pushed the console-url-query-space-escaping-227733 branch 2 times, most recently from 6d5ff4d to 427bb46 Compare May 23, 2026 22:47
@kapral18 kapral18 marked this pull request as ready for review May 23, 2026 23:23
@kapral18 kapral18 requested a review from a team as a code owner May 23, 2026 23:23
@infra-vault-gh-plugin-prod
Copy link
Copy Markdown

Pinging @elastic/kibana-management (Team:Kibana Management)

@kapral18 kapral18 force-pushed the console-url-query-space-escaping-227733 branch from 427bb46 to 54ac103 Compare May 24, 2026 00:04
@kapral18 kapral18 requested a review from Copilot May 24, 2026 00:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. I left one inline comment about the quoted-question-mark case still mis-tokenizing through parseLine/parseUrl, which affects autocomplete context even though the URL string is now preserved.

Generated by Codex Reviewer for issue #270881

@kapral18 kapral18 force-pushed the console-url-query-space-escaping-227733 branch from 54ac103 to 6388bb8 Compare May 24, 2026 00:17
Copy link
Copy Markdown
Contributor

@SoniaSanzV SoniaSanzV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested locally, lgtm!

@kapral18 kapral18 force-pushed the console-url-query-space-escaping-227733 branch 2 times, most recently from 65a4223 to 6e2cc4f Compare May 25, 2026 18:48
Co-authored-by: Cursor <cursoragent@cursor.com>
@kapral18 kapral18 force-pushed the console-url-query-space-escaping-227733 branch from 6e2cc4f to 9b383ab Compare May 25, 2026 22:04
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found one remaining autocomplete consistency issue for quoted question marks in URL paths.

Generated by Codex Reviewer for issue #270881

@kibanamachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Scout Lane #33 - serverless-observability_complete / default / local-serverless-observability_complete - Hosts Page - Empty State - should show onboarding page when no data is present

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
console 208.0KB 208.3KB +320.0B

History

@kapral18 kapral18 merged commit 9d7d161 into elastic:main May 26, 2026
39 of 41 checks passed
@kapral18 kapral18 deleted the console-url-query-space-escaping-227733 branch May 26, 2026 08:17
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.19, 9.3, 9.4

https://github.com/elastic/kibana/actions/runs/26440775997

@kibanamachine
Copy link
Copy Markdown
Contributor

💚 All backports created successfully

Status Branch Result
8.19
9.3
9.4

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request May 26, 2026
# Backport

This will backport the following commits from `main` to `9.4`:
- [[Console] Preserve spaces in URL query strings
(#270881)](#270881)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Karen
Grigoryan","email":"karen.grigoryan@elastic.co"},"sourceCommit":{"committedDate":"2026-05-26T08:17:39Z","message":"[Console]
Preserve spaces in URL query strings (#270881)\n\nCloses #227733\n\n##
Summary\n\n- Preserves unquoted spaces in Console URL query values
instead of\ntreating them as request-line trailing text.\n- Keeps inline
`//` and `#` comment stripping for request URLs.\n- Adds focused
edge-case coverage for the helper and the full\n`parseLine` request-line
path.\n\n## Root Cause\n\n- `removeTrailingWhitespaces` stopped at the
first unquoted space, so\n`GET myindex/_search?q=type:organisation AND
elastic` was truncated\nbefore `AND elastic`.\n\n## Fix\n\n- Use the
first `?` outside quotes as the query-string boundary.\n- Preserve
spaces inside query values unless the space starts a trailing\ninline
`//` or `#` comment.\n- Preserve the existing leading-space behavior and
ignore comment\nmarkers inside quoted query values.\n\n## Before\n<img
width=\"1494\" height=\"1313\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/5ff9ebfe-dc42-4904-a87d-976dbadc2823\"\n/>\n\n##
After\n<img width=\"1482\" height=\"1365\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/cf4bb6b3-56cf-4a39-9932-5d69f2a3cb95\"\n/>\n\n##
Test Plan\n\n- [x] `node
scripts/jest\nsrc/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.test.ts`\n-
[x] `node
scripts/eslint\nsrc/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.ts\nsrc/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.test.ts`\n-
[x] `node scripts/type_check
--project\nsrc/platform/plugins/shared/console/tsconfig.json`\n- [x]
`node scripts/check_changes.ts`\n- [x] Manually verified in Console that
unquoted query spaces are\npreserved, trailing `//` and `#` comments are
stripped, comment markers\ninside quoted query values are preserved,
quoted `?` path text is not\ntreated as the query delimiter, and
trailing non-query text is trimmed\nbefore sending the
request.\n\nAssisted with Cursor using GPT-5.5\n\nCo-authored-by: Cursor
<cursoragent@cursor.com>","sha":"9d7d16103bc774badc83cba0622e7c4fc602e977","branchLabelMapping":{"^v9.5.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Console","Team:Kibana
Management","release_note:skip","backport:all-open","reviewer:claude","v9.5.0","reviewer:codex"],"title":"[Console]
Preserve spaces in URL query
strings","number":270881,"url":"https://github.com/elastic/kibana/pull/270881","mergeCommit":{"message":"[Console]
Preserve spaces in URL query strings (#270881)\n\nCloses #227733\n\n##
Summary\n\n- Preserves unquoted spaces in Console URL query values
instead of\ntreating them as request-line trailing text.\n- Keeps inline
`//` and `#` comment stripping for request URLs.\n- Adds focused
edge-case coverage for the helper and the full\n`parseLine` request-line
path.\n\n## Root Cause\n\n- `removeTrailingWhitespaces` stopped at the
first unquoted space, so\n`GET myindex/_search?q=type:organisation AND
elastic` was truncated\nbefore `AND elastic`.\n\n## Fix\n\n- Use the
first `?` outside quotes as the query-string boundary.\n- Preserve
spaces inside query values unless the space starts a trailing\ninline
`//` or `#` comment.\n- Preserve the existing leading-space behavior and
ignore comment\nmarkers inside quoted query values.\n\n## Before\n<img
width=\"1494\" height=\"1313\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/5ff9ebfe-dc42-4904-a87d-976dbadc2823\"\n/>\n\n##
After\n<img width=\"1482\" height=\"1365\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/cf4bb6b3-56cf-4a39-9932-5d69f2a3cb95\"\n/>\n\n##
Test Plan\n\n- [x] `node
scripts/jest\nsrc/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.test.ts`\n-
[x] `node
scripts/eslint\nsrc/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.ts\nsrc/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.test.ts`\n-
[x] `node scripts/type_check
--project\nsrc/platform/plugins/shared/console/tsconfig.json`\n- [x]
`node scripts/check_changes.ts`\n- [x] Manually verified in Console that
unquoted query spaces are\npreserved, trailing `//` and `#` comments are
stripped, comment markers\ninside quoted query values are preserved,
quoted `?` path text is not\ntreated as the query delimiter, and
trailing non-query text is trimmed\nbefore sending the
request.\n\nAssisted with Cursor using GPT-5.5\n\nCo-authored-by: Cursor
<cursoragent@cursor.com>","sha":"9d7d16103bc774badc83cba0622e7c4fc602e977"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.5.0","branchLabelMappingKey":"^v9.5.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/270881","number":270881,"mergeCommit":{"message":"[Console]
Preserve spaces in URL query strings (#270881)\n\nCloses #227733\n\n##
Summary\n\n- Preserves unquoted spaces in Console URL query values
instead of\ntreating them as request-line trailing text.\n- Keeps inline
`//` and `#` comment stripping for request URLs.\n- Adds focused
edge-case coverage for the helper and the full\n`parseLine` request-line
path.\n\n## Root Cause\n\n- `removeTrailingWhitespaces` stopped at the
first unquoted space, so\n`GET myindex/_search?q=type:organisation AND
elastic` was truncated\nbefore `AND elastic`.\n\n## Fix\n\n- Use the
first `?` outside quotes as the query-string boundary.\n- Preserve
spaces inside query values unless the space starts a trailing\ninline
`//` or `#` comment.\n- Preserve the existing leading-space behavior and
ignore comment\nmarkers inside quoted query values.\n\n## Before\n<img
width=\"1494\" height=\"1313\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/5ff9ebfe-dc42-4904-a87d-976dbadc2823\"\n/>\n\n##
After\n<img width=\"1482\" height=\"1365\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/cf4bb6b3-56cf-4a39-9932-5d69f2a3cb95\"\n/>\n\n##
Test Plan\n\n- [x] `node
scripts/jest\nsrc/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.test.ts`\n-
[x] `node
scripts/eslint\nsrc/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.ts\nsrc/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.test.ts`\n-
[x] `node scripts/type_check
--project\nsrc/platform/plugins/shared/console/tsconfig.json`\n- [x]
`node scripts/check_changes.ts`\n- [x] Manually verified in Console that
unquoted query spaces are\npreserved, trailing `//` and `#` comments are
stripped, comment markers\ninside quoted query values are preserved,
quoted `?` path text is not\ntreated as the query delimiter, and
trailing non-query text is trimmed\nbefore sending the
request.\n\nAssisted with Cursor using GPT-5.5\n\nCo-authored-by: Cursor
<cursoragent@cursor.com>","sha":"9d7d16103bc774badc83cba0622e7c4fc602e977"}}]}]
BACKPORT-->

Co-authored-by: Karen Grigoryan <karen.grigoryan@elastic.co>
Co-authored-by: Cursor <cursoragent@cursor.com>
kibanamachine added a commit that referenced this pull request May 26, 2026
)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[Console] Preserve spaces in URL query strings
(#270881)](#270881)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Karen
Grigoryan","email":"karen.grigoryan@elastic.co"},"sourceCommit":{"committedDate":"2026-05-26T08:17:39Z","message":"[Console]
Preserve spaces in URL query strings (#270881)\n\nCloses #227733\n\n##
Summary\n\n- Preserves unquoted spaces in Console URL query values
instead of\ntreating them as request-line trailing text.\n- Keeps inline
`//` and `#` comment stripping for request URLs.\n- Adds focused
edge-case coverage for the helper and the full\n`parseLine` request-line
path.\n\n## Root Cause\n\n- `removeTrailingWhitespaces` stopped at the
first unquoted space, so\n`GET myindex/_search?q=type:organisation AND
elastic` was truncated\nbefore `AND elastic`.\n\n## Fix\n\n- Use the
first `?` outside quotes as the query-string boundary.\n- Preserve
spaces inside query values unless the space starts a trailing\ninline
`//` or `#` comment.\n- Preserve the existing leading-space behavior and
ignore comment\nmarkers inside quoted query values.\n\n## Before\n<img
width=\"1494\" height=\"1313\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/5ff9ebfe-dc42-4904-a87d-976dbadc2823\"\n/>\n\n##
After\n<img width=\"1482\" height=\"1365\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/cf4bb6b3-56cf-4a39-9932-5d69f2a3cb95\"\n/>\n\n##
Test Plan\n\n- [x] `node
scripts/jest\nsrc/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.test.ts`\n-
[x] `node
scripts/eslint\nsrc/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.ts\nsrc/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.test.ts`\n-
[x] `node scripts/type_check
--project\nsrc/platform/plugins/shared/console/tsconfig.json`\n- [x]
`node scripts/check_changes.ts`\n- [x] Manually verified in Console that
unquoted query spaces are\npreserved, trailing `//` and `#` comments are
stripped, comment markers\ninside quoted query values are preserved,
quoted `?` path text is not\ntreated as the query delimiter, and
trailing non-query text is trimmed\nbefore sending the
request.\n\nAssisted with Cursor using GPT-5.5\n\nCo-authored-by: Cursor
<cursoragent@cursor.com>","sha":"9d7d16103bc774badc83cba0622e7c4fc602e977","branchLabelMapping":{"^v9.5.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Console","Team:Kibana
Management","release_note:skip","backport:all-open","reviewer:claude","v9.5.0","reviewer:codex"],"title":"[Console]
Preserve spaces in URL query
strings","number":270881,"url":"https://github.com/elastic/kibana/pull/270881","mergeCommit":{"message":"[Console]
Preserve spaces in URL query strings (#270881)\n\nCloses #227733\n\n##
Summary\n\n- Preserves unquoted spaces in Console URL query values
instead of\ntreating them as request-line trailing text.\n- Keeps inline
`//` and `#` comment stripping for request URLs.\n- Adds focused
edge-case coverage for the helper and the full\n`parseLine` request-line
path.\n\n## Root Cause\n\n- `removeTrailingWhitespaces` stopped at the
first unquoted space, so\n`GET myindex/_search?q=type:organisation AND
elastic` was truncated\nbefore `AND elastic`.\n\n## Fix\n\n- Use the
first `?` outside quotes as the query-string boundary.\n- Preserve
spaces inside query values unless the space starts a trailing\ninline
`//` or `#` comment.\n- Preserve the existing leading-space behavior and
ignore comment\nmarkers inside quoted query values.\n\n## Before\n<img
width=\"1494\" height=\"1313\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/5ff9ebfe-dc42-4904-a87d-976dbadc2823\"\n/>\n\n##
After\n<img width=\"1482\" height=\"1365\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/cf4bb6b3-56cf-4a39-9932-5d69f2a3cb95\"\n/>\n\n##
Test Plan\n\n- [x] `node
scripts/jest\nsrc/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.test.ts`\n-
[x] `node
scripts/eslint\nsrc/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.ts\nsrc/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.test.ts`\n-
[x] `node scripts/type_check
--project\nsrc/platform/plugins/shared/console/tsconfig.json`\n- [x]
`node scripts/check_changes.ts`\n- [x] Manually verified in Console that
unquoted query spaces are\npreserved, trailing `//` and `#` comments are
stripped, comment markers\ninside quoted query values are preserved,
quoted `?` path text is not\ntreated as the query delimiter, and
trailing non-query text is trimmed\nbefore sending the
request.\n\nAssisted with Cursor using GPT-5.5\n\nCo-authored-by: Cursor
<cursoragent@cursor.com>","sha":"9d7d16103bc774badc83cba0622e7c4fc602e977"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.5.0","branchLabelMappingKey":"^v9.5.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/270881","number":270881,"mergeCommit":{"message":"[Console]
Preserve spaces in URL query strings (#270881)\n\nCloses #227733\n\n##
Summary\n\n- Preserves unquoted spaces in Console URL query values
instead of\ntreating them as request-line trailing text.\n- Keeps inline
`//` and `#` comment stripping for request URLs.\n- Adds focused
edge-case coverage for the helper and the full\n`parseLine` request-line
path.\n\n## Root Cause\n\n- `removeTrailingWhitespaces` stopped at the
first unquoted space, so\n`GET myindex/_search?q=type:organisation AND
elastic` was truncated\nbefore `AND elastic`.\n\n## Fix\n\n- Use the
first `?` outside quotes as the query-string boundary.\n- Preserve
spaces inside query values unless the space starts a trailing\ninline
`//` or `#` comment.\n- Preserve the existing leading-space behavior and
ignore comment\nmarkers inside quoted query values.\n\n## Before\n<img
width=\"1494\" height=\"1313\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/5ff9ebfe-dc42-4904-a87d-976dbadc2823\"\n/>\n\n##
After\n<img width=\"1482\" height=\"1365\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/cf4bb6b3-56cf-4a39-9932-5d69f2a3cb95\"\n/>\n\n##
Test Plan\n\n- [x] `node
scripts/jest\nsrc/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.test.ts`\n-
[x] `node
scripts/eslint\nsrc/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.ts\nsrc/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.test.ts`\n-
[x] `node scripts/type_check
--project\nsrc/platform/plugins/shared/console/tsconfig.json`\n- [x]
`node scripts/check_changes.ts`\n- [x] Manually verified in Console that
unquoted query spaces are\npreserved, trailing `//` and `#` comments are
stripped, comment markers\ninside quoted query values are preserved,
quoted `?` path text is not\ntreated as the query delimiter, and
trailing non-query text is trimmed\nbefore sending the
request.\n\nAssisted with Cursor using GPT-5.5\n\nCo-authored-by: Cursor
<cursoragent@cursor.com>","sha":"9d7d16103bc774badc83cba0622e7c4fc602e977"}}]}]
BACKPORT-->

Co-authored-by: Karen Grigoryan <karen.grigoryan@elastic.co>
Co-authored-by: Cursor <cursoragent@cursor.com>
kibanamachine added a commit that referenced this pull request May 26, 2026
# Backport

This will backport the following commits from `main` to `9.3`:
- [[Console] Preserve spaces in URL query strings
(#270881)](#270881)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Karen
Grigoryan","email":"karen.grigoryan@elastic.co"},"sourceCommit":{"committedDate":"2026-05-26T08:17:39Z","message":"[Console]
Preserve spaces in URL query strings (#270881)\n\nCloses #227733\n\n##
Summary\n\n- Preserves unquoted spaces in Console URL query values
instead of\ntreating them as request-line trailing text.\n- Keeps inline
`//` and `#` comment stripping for request URLs.\n- Adds focused
edge-case coverage for the helper and the full\n`parseLine` request-line
path.\n\n## Root Cause\n\n- `removeTrailingWhitespaces` stopped at the
first unquoted space, so\n`GET myindex/_search?q=type:organisation AND
elastic` was truncated\nbefore `AND elastic`.\n\n## Fix\n\n- Use the
first `?` outside quotes as the query-string boundary.\n- Preserve
spaces inside query values unless the space starts a trailing\ninline
`//` or `#` comment.\n- Preserve the existing leading-space behavior and
ignore comment\nmarkers inside quoted query values.\n\n## Before\n<img
width=\"1494\" height=\"1313\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/5ff9ebfe-dc42-4904-a87d-976dbadc2823\"\n/>\n\n##
After\n<img width=\"1482\" height=\"1365\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/cf4bb6b3-56cf-4a39-9932-5d69f2a3cb95\"\n/>\n\n##
Test Plan\n\n- [x] `node
scripts/jest\nsrc/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.test.ts`\n-
[x] `node
scripts/eslint\nsrc/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.ts\nsrc/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.test.ts`\n-
[x] `node scripts/type_check
--project\nsrc/platform/plugins/shared/console/tsconfig.json`\n- [x]
`node scripts/check_changes.ts`\n- [x] Manually verified in Console that
unquoted query spaces are\npreserved, trailing `//` and `#` comments are
stripped, comment markers\ninside quoted query values are preserved,
quoted `?` path text is not\ntreated as the query delimiter, and
trailing non-query text is trimmed\nbefore sending the
request.\n\nAssisted with Cursor using GPT-5.5\n\nCo-authored-by: Cursor
<cursoragent@cursor.com>","sha":"9d7d16103bc774badc83cba0622e7c4fc602e977","branchLabelMapping":{"^v9.5.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Console","Team:Kibana
Management","release_note:skip","backport:all-open","reviewer:claude","v9.5.0","reviewer:codex"],"title":"[Console]
Preserve spaces in URL query
strings","number":270881,"url":"https://github.com/elastic/kibana/pull/270881","mergeCommit":{"message":"[Console]
Preserve spaces in URL query strings (#270881)\n\nCloses #227733\n\n##
Summary\n\n- Preserves unquoted spaces in Console URL query values
instead of\ntreating them as request-line trailing text.\n- Keeps inline
`//` and `#` comment stripping for request URLs.\n- Adds focused
edge-case coverage for the helper and the full\n`parseLine` request-line
path.\n\n## Root Cause\n\n- `removeTrailingWhitespaces` stopped at the
first unquoted space, so\n`GET myindex/_search?q=type:organisation AND
elastic` was truncated\nbefore `AND elastic`.\n\n## Fix\n\n- Use the
first `?` outside quotes as the query-string boundary.\n- Preserve
spaces inside query values unless the space starts a trailing\ninline
`//` or `#` comment.\n- Preserve the existing leading-space behavior and
ignore comment\nmarkers inside quoted query values.\n\n## Before\n<img
width=\"1494\" height=\"1313\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/5ff9ebfe-dc42-4904-a87d-976dbadc2823\"\n/>\n\n##
After\n<img width=\"1482\" height=\"1365\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/cf4bb6b3-56cf-4a39-9932-5d69f2a3cb95\"\n/>\n\n##
Test Plan\n\n- [x] `node
scripts/jest\nsrc/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.test.ts`\n-
[x] `node
scripts/eslint\nsrc/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.ts\nsrc/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.test.ts`\n-
[x] `node scripts/type_check
--project\nsrc/platform/plugins/shared/console/tsconfig.json`\n- [x]
`node scripts/check_changes.ts`\n- [x] Manually verified in Console that
unquoted query spaces are\npreserved, trailing `//` and `#` comments are
stripped, comment markers\ninside quoted query values are preserved,
quoted `?` path text is not\ntreated as the query delimiter, and
trailing non-query text is trimmed\nbefore sending the
request.\n\nAssisted with Cursor using GPT-5.5\n\nCo-authored-by: Cursor
<cursoragent@cursor.com>","sha":"9d7d16103bc774badc83cba0622e7c4fc602e977"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.5.0","branchLabelMappingKey":"^v9.5.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/270881","number":270881,"mergeCommit":{"message":"[Console]
Preserve spaces in URL query strings (#270881)\n\nCloses #227733\n\n##
Summary\n\n- Preserves unquoted spaces in Console URL query values
instead of\ntreating them as request-line trailing text.\n- Keeps inline
`//` and `#` comment stripping for request URLs.\n- Adds focused
edge-case coverage for the helper and the full\n`parseLine` request-line
path.\n\n## Root Cause\n\n- `removeTrailingWhitespaces` stopped at the
first unquoted space, so\n`GET myindex/_search?q=type:organisation AND
elastic` was truncated\nbefore `AND elastic`.\n\n## Fix\n\n- Use the
first `?` outside quotes as the query-string boundary.\n- Preserve
spaces inside query values unless the space starts a trailing\ninline
`//` or `#` comment.\n- Preserve the existing leading-space behavior and
ignore comment\nmarkers inside quoted query values.\n\n## Before\n<img
width=\"1494\" height=\"1313\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/5ff9ebfe-dc42-4904-a87d-976dbadc2823\"\n/>\n\n##
After\n<img width=\"1482\" height=\"1365\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/cf4bb6b3-56cf-4a39-9932-5d69f2a3cb95\"\n/>\n\n##
Test Plan\n\n- [x] `node
scripts/jest\nsrc/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.test.ts`\n-
[x] `node
scripts/eslint\nsrc/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.ts\nsrc/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.test.ts`\n-
[x] `node scripts/type_check
--project\nsrc/platform/plugins/shared/console/tsconfig.json`\n- [x]
`node scripts/check_changes.ts`\n- [x] Manually verified in Console that
unquoted query spaces are\npreserved, trailing `//` and `#` comments are
stripped, comment markers\ninside quoted query values are preserved,
quoted `?` path text is not\ntreated as the query delimiter, and
trailing non-query text is trimmed\nbefore sending the
request.\n\nAssisted with Cursor using GPT-5.5\n\nCo-authored-by: Cursor
<cursoragent@cursor.com>","sha":"9d7d16103bc774badc83cba0622e7c4fc602e977"}}]}]
BACKPORT-->

Co-authored-by: Karen Grigoryan <karen.grigoryan@elastic.co>
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:all-open Backport to all branches that could still receive a release Feature:Console Dev Tools Console Feature release_note:skip Skip the PR/issue when compiling release notes reviewer:claude PR review and comments with Claude reviewer:codex PR review and comments with Codex Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more t// v8.19.16 v9.3.5 v9.4.2 v9.5.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Console used to escape spaces in url but no longer does

4 participants